<template>
  <div class="vx-product-summary">
    <p class="theme-title">
      <span>产品概览</span>
    </p>
    <div class="product-chart"></div>
    <div class="product-msg">产品组总数/已售出总数</div>
  </div>
</template>

<script>
import Clay from '@csii/vx-clay/dist/clay-template.js';
import './ui-product-summary';
export default {
  name: 'vx-product-summary',
  props: {
    data: {
      type: Object,
      default: () => {},
    },
  },
  watch: {
    data: {
      handler() {
        this.painterAsset();
      },
      deep: true,
    },
  },
  methods: {
    /**
     * @description:创建数据图像,图形绘制跳转
     */
    painterAsset() {
      const that = this;
      window.zl = new Clay({
        el: document.querySelector('.product-chart'),
        template: `
        <ui-product-summary c-bind:data="productSummary"></ui-product-summary>
        `,
        data() {
          return {
            productSummary: that.data,
          };
        },
      });
    },
  },
};
</script>

<style lang="scss">
.vx-product-summary {
  flex: 1;
  height: 350px;
  .product-chart {
    margin-left: 240px;
    width: 240px;
    height: 240px;
  }
  .product-msg {
    font-size: 14px;
    margin-left: 284px;
  }
}
</style>
